/* 
 * Since 2008 - 2012
 */

package com.hh.bss.sysadmin.service.impl;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

import com.hh.bss.base.*;
import com.hh.bss.common.exception.RepeatRecordException;
import com.hh.bss.common.page.*;
import com.hh.bss.common.page.impl.*;
import com.hh.bss.sysadmin.dao.*;
import com.hh.bss.sysadmin.entity.*;
import com.hh.bss.sysadmin.service.*;
import com.hh.bss.sysadmin.vo.query.*;
import com.hh.bss.util.*;




@Service
@Transactional
public class SystemDicMapServiceImpl extends BaseBusinessService<SystemDicMap,java.lang.Integer>  implements SystemDicMapService<SystemDicMap,java.lang.Integer>{

	private SystemDicMapDao systemDicMapDao;
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	public void setSystemDicMapDaoImpl(SystemDicMapDao dao) {
		this.systemDicMapDao = dao;
	}
	public EntityDao getEntityDao() {
		return this.systemDicMapDao;
	}
	
	@Transactional(readOnly=true)
	public Page findPage(SystemDicMapQuery query) {
		return systemDicMapDao.findPage(query);
	}
	@Override
	public void save(SystemDicMap entity)  {
	    String hql = " from SystemDicMap t where t.id = ? ";
	    List list = this.getEntityDao().getHibernateTemplate().find(hql, entity.getId());
	    if(list !=null && list.size() >0 ){
	    	throw new RepeatRecordException("ID 已经存在,请检查 ID ");
	    }else{
	    	super.save(entity);
	    }
	}
	@Override
	public List getAllDicMap(SystemDicMapQuery query) {
		// TODO Auto-generated method stub
		return systemDicMapDao.getAllDicMap(query);
	}
	
	
	
}
